
import requests

# 提取代理API接口，获取1个代理IP
# 提取代理API接口，获取1个代理IP
api_url = ""


proxy_ip = requests.get(api_url).text

username = ""
password = " "
proxies = {
    "http": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": proxy_ip},
    "https": "http://%(user)s:%(pwd)s@%(proxy)s/" % {"user": username, "pwd": password, "proxy": proxy_ip}
}


target_url = "https://dev.kdlapi.com/testproxy"

response = requests.get(target_url, proxies=proxies)

if response.status_code == 200:
    print(response.text)

res = requests.get("http://httpbin.org/get", proxies=proxies)
print(f"IP: {res.json()['origin']}")
